package com.hxkj.service.article;

import com.hxkj.domain.po.Resources;
import com.hxkj.domain.po.ResourcesTree;
import com.platform.common.domain.result.ResultDataStruct;
import com.platform.common.domain.result.ResultMessageStruct;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 网站资源Service
 * <p>
 * Created by yaosy on 2018年6月6日
 */
public interface ResourcesService {


    /**
     * 新建文件资源
     * @param resources
     * @return
     * @throws Exception
     */
    Resources saveResources(Resources resources)throws Exception;


    /**
     * 新建目录资源
     * @param resources
     * @return
     * @throws Exception
     */
    Resources saveResourcesFolder(Resources resources)throws Exception;

    /**
     * 资源多文件上传
     * @param
     * @return
     * @throws Exception
     */
    ResultDataStruct<List<String>> upload(MultipartFile[] file);

    /**
     * 资源功能树
     * @param resources
     * @return
     * @throws Exception
     */
    List<ResourcesTree>  getResourcesTree(Resources resources) throws Exception;

    /**
     * 资源编辑
     * @param resources
     * @return
     * @throws Exception
     */
    ResultMessageStruct modify(Resources resources)throws Exception;


    /**
     * 获取单条资源数据
     * @param resources
     * @return
     * @throws Exception
     */
    ResultDataStruct<Resources> get(Resources resources) throws Exception;

    /**
     * 删除模板
     * @param resources
     * @return
     * @throws Exception
     */
    ResultMessageStruct remove(Resources resources)throws Exception;


    /***
     * 上传文件后保存到数据库当中
     *
     * @param templet
     * @throws Exception
     * ***/
    Resources saveUploadContent(Resources templet)throws Exception;

    /***
     * 根据站点下载资源文件
     *
     * @param resources
     * @throws Exception
     * ***/
    void download(HttpServletRequest request, HttpServletResponse response , Resources resources)throws Exception;
}
